<!DOCTYPE html>
<html>
  <head>
    <title>jQuery WeUI</title>
    <meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"/>

<meta name="description" content="Write an awesome description for your new site here. You can edit this line in _config.yml. It will appear in your document head meta (for Google search results) and in your feed.xml site description.
"/>

<link rel="stylesheet" th:href="@{/dist/lib/weui.min.css}" />
<link rel="stylesheet" th:href="@{/dist/css/jquery-weui.min.css}" />
<link rel="stylesheet" th:href="@{/dist/demos/css/demos.css}" />
<script type="text/javascript" th:src="@{/dist/lib/jquery-2.1.4.js}" ></script>
<script type="text/javascript" th:src="@{/dist/js/jquery-weui.js}" ></script>
<script type="text/javascript" th:src="@{/dist/lib/fastclick.js}" ></script>
<link rel="stylesheet" th:href="@{/adminltecss/userl.css}" />
<link href="//netdna.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
                        
<style>
	.weui-cell{
		padding:10px;
		margin-top: 3px;
	}
	.cusmar{
  		margin-left: 40px;
  	}
  	.header-wai{
  		position: fixed;top:0px; height:60px;background-color: #363436;
  	}
</style>
<script type="text/javascript" th:inline="javascript">
	/*<![CDATA[*/

		function passDemo(){
			var pass=$("input[name='pass']").val();
			var reg1=/^.*[\d]+.*$/;
			var reg2=/^.*[A-Za-z]+.*$/;
			
			if(pass==""){
				
				$.alert("密码不能为空");
				return false;
			}else if(pass.length>16 || pass.length<8)
		    {   
				
		       
				$.alert("密码应为8-16个字符，区分大小写");
		        return false;
		    }
		   
			return true;
		}
		 function repassDemo(){
			 var repass=$("input[name='repass']").val();
			 var pass=$("input[name='pass']").val();
			
			 if(pass==""){
				
				 return false
			 }else if(repass!=pass){
				
				 $.alert("两次输入的密码不一致，请重新输入");
				 return false;
				 
			 }
			 return true;
		 }
		 
		 function userDemo(){
			//在js中获取controller传过来的数据
			var aa=/*[[${session.EmployeeInfo.ephone}]]*/;
			
				var username=$("input[name='username']").val();
				reg=/^1[3|4|5|8][0-9]\d{8}$/;
				if(username==""){
					
					$.alert("手机号不能为空");
					return false;
				}
				if(!reg.test(username)){
					
					$.alert("手机号格式不正确，请输入正确手机号码");
					return false;
				}
				if(username!=aa){
					$.alert("手机号码不一致，请从新输入");
					return false;
				}
				
				return true;
				}
		 
		 var flag=0;
		 function checkDemo(domEle){
			
			
			 $(domEle).attr("disabled","disabled");
			 /*获取电话号码  */
			 var username=$("input[name='username']").val();
			 
			 if(!userDemo()){
				
				 $(domEle).removeAttr("disabled");
				return false;
			 }
			 $.post(
				"/WBizController/CheckIsSendSuccess",
				{
					"phone":username
				},
				function(data){
					$.alert(data)
					var info=data.simpleResult.code;
					
					if(info=="0"){
						$.alert("验证码发送成功！");
						flag=0;
						 var i=120;
						 settime=setInterval(function(){
							
					    		$(domEle).html(i);
					    		
					    		if(i==0){
					    			 clearInterval(settime);
					    			 $(domEle).html("获取验证码");
									 $(domEle).removeAttr("disabled");
					    			 return;
					    		}
					    		i=i-1;
					    	},1000);
					}else if(info=="1"){
						$.alert("验证码发送失败！");
						flag=1;
					}
				},
				"json"
			 
			 
			 );
			
			 
			/*  var i=120;
			 settime=setInterval(function(){
				
		    		$(domEle).html(i);
		    		
		    		if(i==0){
		    			 clearInterval(settime);
		    			 $(domEle).html("获取验证码");
						 $(domEle).removeAttr("disabled");
		    			 return;
		    		}
		    		i=i-1;
		    	},1000); */
			
		 }
		
		 
		 /*返回上一级  */
			function returnDemo(){
				window.history.back(-1); 
			}
		 /*]]>*/	
</script>
  </head>
  <body ontouchstart class="weui-pull-to-refresh">
  <div class="weui-tabbar header-wai" style="">
  		<a href="" class="weui-tabbar__item"  id="cusdow">
          <div class="weui-tabbar__icon"></div>
          <p class="weui-tabbar__label" style="font-size: 20px; color: white; line-height: 1px;">
          	<span class="fa fa-angle-left fa-2x" style="color: white; float: left;line-height: 10px;" onclick="returnDemo()"></span>
          	修改密码<span class="fa fa-angle-down fa-2x" style="color: white;float: right; margin-right: 10px;line-height: 10px; " id="down"></span></p>
        </a>
      </div>
  	<div class="weui-pull-to-refresh__layer" style="margin-top:40px">
      <div class='weui-pull-to-refresh__arrow'></div>
      <div class='weui-pull-to-refresh__preloader'></div>
      <div class="down">下拉刷新</div>
      <div class="up">释放刷新</div>
      <div class="refresh">正在刷新</div>
    </div>
  	<div class="weui-grids wrap">
  			
  	<div class="weui-cells weui-cells-form">
  		
      <div class="weui-cell">
        <div class="weui-cell__hd"><label class="weui-label">姓名</label></div>
        <div class="weui-cell__bd">
          <input class="weui-input"   type="text" th:value="${session.EmployeeInfo.ename}"/>
        </div>
      </div>
      <div class="weui-cell weui-cell_vcode">
        <div class="weui-cell__hd">
          <label class="weui-label">手机号</label>
        </div>
        <div class="weui-cell__bd">
          <input class="weui-input" placeholder="请输入手机号" name="username" type="tel" onblur="userDemo()"/>
        </div>
        <div class="weui-cell__ft">
          <button class="weui-vcode-btn" onclick="checkDemo(this)">获取验证码</button>
        </div>
      </div>
      <div class="weui-cell">
        <div class="weui-cell__hd"><label class="weui-label">新密码</label></div>
        <div class="weui-cell__bd">
          <input class="weui-input"  placeholder="请输入新密码" type="number" name="pass" onblur="passDemo()"/>
        </div>
      </div>
      <div class="weui-cell">
        <div class="weui-cell__hd"><label class="weui-label">确认密码</label></div>
        <div class="weui-cell__bd">
        <!--pattern="[0-9]*"  -->
          <input class="weui-input"  placeholder="请再输入一遍" type="number" name="repass" onblur="repassDemo()"/>
        </div>
      </div>
      <div class="weui-cell weui-cell_vcode">
        <div class="weui-cell__hd"><label class="weui-label">验证码</label></div>
        <div class="weui-cell__bd">
          <input class="weui-input" placeholder="请输入验证码" type="number" id="checkYan"/>
        </div>
        <div class="weui-cell__ft">
         <!--  <img class="weui-vcode-img" th:src="@{/demos/images/vcode.jpg}"/> -->
        </div>
      </div>
    <div class='demos-content-padded'>
      <a href="javascript:;" id='show-toast' class="weui-btn weui-btn_primary">确认提交</a>
     </div>
      
  		
  		
  		
  		
  		
  	</div>
  
      
 
       <br/>
      <br/>
      <div class="weui-tabbar" style="position: fixed;">
        <a th:href="@{/WHeadInfoController/intoMainPage}" class="weui-tabbar__item weui-bar__item--on">
         <!--  <span class="weui-badge" style="position: absolute;top: -.4em;right: 1em;">8</span> -->
          <div class="weui-tabbar__icon">
            
            <img th:src="@{/demos/images/icon_nav_button.png}" />
          </div>
          <p class="weui-tabbar__label">首页</p>
        </a>
        
        
        
        
        
         
        <!--判断是否登陆  -->
        <a href="javascript:void(0)" class="weui-tabbar__item" th:if="${session.EmployeeInfo!=null}"> 
          <div class="weui-tabbar__icon">
            <img th:src="@{/demos/images/icon_nav_msg.png}" alt=""/>
          </div>
          <p class="weui-tabbar__label">菜单</p>
        </a>
        
        <a th:href="@{/WBizController/loginDemo}" class="weui-tabbar__item" th:if="${session.EmployeeInfo==null}"> 
          <div class="weui-tabbar__icon">
            <img th:src="@{/demos/images/icon_nav_msg.png}" alt=""/>
          </div>
          <p class="weui-tabbar__label">菜单</p>
        </a>

		<!--判断是否登陆  -->
        <a th:href="@{/selectAllCustomers}" class="weui-tabbar__item" th:if="${session.EmployeeInfo!=null}">

          <div class="weui-tabbar__icon">
            <img th:src="@{/demos/images/icon_nav_article.png}" alt=""/>
          </div>
          <p class="weui-tabbar__label">客户</p>
        </a>
         <a th:href="@{/WBizController/loginDemo}" class="weui-tabbar__item" th:if="${session.EmployeeInfo==null}">

          <div class="weui-tabbar__icon">
            <img th:src="@{/demos/images/icon_nav_article.png}" alt=""/>
          </div>
          <p class="weui-tabbar__label">客户</p>
        </a>
        
        
        
        
        
        
        
        <a th:href="@{/WBizController/HeadPage}" class="weui-tabbar__item">
          <div class="weui-tabbar__icon">
            <img th:src="@{/demos/images/icon_nav_cell.png}" alt=""/>
          </div>
          <p class="weui-tabbar__label">我的</p>
        </a>
      </div>
      
  	
  	</div>
  	
  
  	<script>
  $(function() {
    FastClick.attach(document.body);
  });
</script>
  	<script type="text/javascript" th:inline="javascript">
  		$(document).on("click", "#show-toast", function() {
       /*  $.toast("修改成功", function() {
          console.log('close');
        }); */
        var checkDemo=$("#checkYan").val();
        var eid=/*[[${session.EmployeeInfo.eid}]]*/
            
        if(checkDemo==""){
        	$.alert("验证码不能为空");
        	return false;
        	
        }
        if(!(passDemo()&&repassDemo()&&userDemo())){
        	 return  false;
        }
      
        var pass=$("input[name='pass']").val();
       
        	$.post(
        		"/WBizController/updatePassWordById",
        		{
        			"password":pass,
        			"identifying":checkDemo,
        			"eid":eid
        			
        		},
        		function(result){
        				var code=result.simpleResult.code;
        				if(code=="0"){
        					$.alert("修改成功，请重新登陆");
        				window.location.href="/WBizController/loginDemo?stat=0";
        				}else if(code=="1"){
        					$.alert("修改失败");
        				}else if(code=="2"){
        					$.alert("验证码错误");
        				}
        		},
        		"json"
        	
        		);
        	
        
      })
      .on("click", "#show-toast-cancel", function() {
        $.toast("取消操作", "cancel", function(toast) {
          console.log(toast);
        });
      })
      .on("click", "#show-toast-forbidden", function() {
        $.toast("禁止操作", "forbidden");
      })
      .on("click", "#show-toast-text", function() {
        $.toast("纯文本", "text");
      })
      .on("click", "#show-loading", function() {
        $.showLoading();

        setTimeout(function() {
          $.hideLoading();
        }, 3000)
      });
       $(document.body).pullToRefresh(function() {
        setTimeout(function() {
          $("#time").text(new Date);
          $(document.body).pullToRefreshDone();
        }, 2000);
      });
      $("#trigger").click(function () {
        $(document.body).pullToRefresh('triggerPullToRefresh')
      })
      $("#a").select({
        title: "选择职业",
        items: ["法官", "医生", "猎人", "学生", "记者", "其他"]
      });
  	</script>
  	</body>
  </html>
